echo off
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome

echo.
echo ERROR: JAVA_HOME not found in your environment.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation
echo.
goto error

:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory.
echo JAVA_HOME = %JAVA_HOME%
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation
echo.
goto error

@REM ==== END VALIDATION ====

:init
@REM Decide how to startup depending on the version of windows

@REM -- Regular WinNT shell
set JINGSY_CMD_LINE_ARGS=%*
goto endInit

@REM Reaching here means variables are defined and arguments have been captured
:endInit
SET JINGSY_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

@REM Start JINGSY
:runm2
%JINGSY_JAVA_EXE% -classpath boot\classworlds-*.jar "-Dclassworlds.conf=jingsy.conf" org.codehaus.classworlds.Launcher %JINGSY_CMD_LINE_ARGS%
